package cn.hty.mymsg.handler.deduplication.limit;

import cn.hty.mymsg.common.domain.TaskInfo;
import cn.hty.mymsg.handler.deduplication.DeduplicationParam;
import cn.hty.mymsg.handler.deduplication.service.AbstractDeduplicationService;
import org.apache.kafka.common.protocol.types.Field;

import javax.print.DocFlavor;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

public abstract class AbstractLimitService implements LimitService {
    /**
     * 获取模板的去重key
     * @return
     */
    protected List<String> deduplicationAllKey(AbstractDeduplicationService service, TaskInfo taskInfo){
        List<String> result = new ArrayList<>(taskInfo.getReceiver().size());
        for (String receiver : taskInfo.getReceiver()) {
            String key = deduplicationSingleKey(service, taskInfo, receiver);
            result.add(key);
        }
        return result;
    }
    protected String deduplicationSingleKey(AbstractDeduplicationService service, TaskInfo taskInfo, String receiver){
        return service.deduplicationSingleKey(taskInfo,receiver);
    }
}
